-
Notifications
You must be signed in to change notification settings - Fork 19
Rotation Gates #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Rotation Gates #95
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #95 +/- ##
==========================================
- Coverage 75.96% 75.33% -0.63%
==========================================
Files 19 20 +1
Lines 828 892 +64
==========================================
+ Hits 629 672 +43
- Misses 199 220 +21 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start, thank you for engaging with this.
I am leaving a few comments on suggested structure below.
We should probably also add some simplification rules to the database of rules: https://github.com/QuantumSavory/QuantumSymbolics.jl/blob/main/src/QSymbolicsBase/rules.jl
It can be a new _ROT
list of rules, containing things like Rot(a)*Rot(b) = Rot(a+b)
and commutation relationships between them and commutation relationships with Paulis, and conversion of exponentials of Paulis into rot gates.
For testing we can add something that checks an equality of a bunch of expressions of the type express(expr) == express(expr(simplify(expr)))
-- that way we check consistency between the numerical representation and the symbolic simplification rules.
Summary of changes made
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this! There are a couple of simplification rules that I do not fully understand, could you address the questions below?
Are there predefined rotations gates in QuantumOptics.jl? If yes, we should probably use them or at least make sure we are consistent with them.
Marking as draft just so I can keep my review queue organized. Do not hesitate to mark it back as ready and re-request a review. |
Summary of changes from previous review:
CHANGELOG:
Notes:
Please let me know if I should change that, or make any other improvements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just one minor change, otherwise this looks great
src/QSymbolicsBase/predefined.jl
Outdated
children(x::RotZGate) = [:Rz, x.θ] | ||
symbollabel(x::RotZGate) = "Rz($(x.θ))" | ||
"""Rotation around the Z axis""" | ||
Rz(θ) = (θ == 0) ? I : RotZGate(θ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we do not need separate functions for this type.
- note that in the CNOT case, it is an instance, not a new renamed constructor
- note that in the symbolic trace case, it is a way to hook into an existing LinearAlgebra API, so that is why we have a renamed constructor -- no-preexisting API to hook into here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed these functions.
However, the @withmetadata
macro does not work with constructors inside the struct
The $\theta$ == 0
rule has been added to rules.jl
QuantumSymbolics.jl is currently missing rotation gates.
I decided to implement these gates as RGate, which are structs which take in a direction and angle.
express
functionality for QuantumOpticsRepr is also implementedCHANGELOG:
express
in QuantumOpticsReprCHECKLIST:
Edit from Stefan: closes #94